package com.sinog.auth.repository;

import com.sinog.auth.entity.SystemUser;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @desc 单点登录使用
 * @author Administrator
 * @date -
 */
public interface SystemUserRepository extends BaseRepository<SystemUser> {

    /**
     * 根据手机号，查询账号
     * @param token 手机号
     * @return 账号
     */
    @Query("select tb.account from SystemUser as tb where tb.phone=:token")
    String findAccountByPhone(@Param("token") String token);

    /**
     * 根据部门id查询账号信息
     * @param departid 部门id
     * @return 账号
     */
    @Query("select tb.account from SystemUser as tb where tb.departid=:areaCode")
    String findAccountByDepartid(@Param("areaCode") String departid);
}